import 'package:flutter/material.dart';

void main() =>
    runApp(MyApp(items: new List<String>.generate(1000, (i) => "Item $i")));

class MyApp extends StatelessWidget {
  // 继承父级参数
  MyApp({Key key, @required this.items}) : super(key: key);

  // 数组列表
  final List<String> items;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'list 学习',
        home: Scaffold(
          appBar: AppBar(title: Text('aaa')),
          body: ListView.builder(
            itemCount: items.length,
            itemBuilder: (BuildContext context, int index) {
              return ListTile(
                title: Text('Item $index'),
              );
            },
          ),
        ));
  }
}
